package com.asyf.demo.config.mydefined;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import com.zaxxer.hikari.pool.HikariPool;
import lombok.extern.slf4j.Slf4j;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @Author yjz
 * @Date 2022/12/31 21:42
 */
@Slf4j
public class MyHikariDataSource extends HikariDataSource {

    public MyHikariDataSource() {
        super();
    }

    public MyHikariDataSource(HikariConfig configuration) {
        super(configuration);
    }

    @Override
    public Connection getConnection() throws SQLException {
        Exception e = new Exception("连接池调用链路");
        log.info("连接池调用链路:", e);
        Connection conn = super.getConnection();
        conn = MyConnectionLeakProxy.newProxy(conn, this.getPoolName());
        return conn;
    }

    @Override
    public String getConnectionInitSql() {
        return super.getConnectionInitSql();
    }


}
